package org.example.DesignPatterns.Interpreter;

/**
 * @description:延迟终极表达式
 * @author: farprt
 * @create: 2022-09-25 13:48
 **/
public class Delay implements Expression {

    private int seconds;

    public Delay(int seconds){
        this.seconds=seconds;
    }

    public int getSeconds(){
        return seconds;
    }

    @Override
    public void interpret() {
        System.out.println("系统延迟："+seconds+"秒");
        try {
            Thread.sleep(seconds*1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}